package ar.Location.UI;

import android.content.Context;
import android.graphics.Bitmap;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import ar.Location.PlaceObject.Place;
import ar.activity.R;

public class PlaceResultItemView extends LinearLayout {

	//private static final String TAG = "PlaceResultItemView";
	public Context listViewItemContext = null;
	public TextView txtViewName = null;
	public TextView txtViewDistance = null;
	public TextView txtViewDescription = null;
	public ImageView imgIconName = null;
	public ImageView imgIconDescription = null;
	public ImageView imgView = null;
	public ProgressBar progressBar = null;

	public PlaceResultItemView(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
		initContext(context);
		initView();
	}
	
	private void initContext(Context context) {
		// TODO Auto-generated method stub
		listViewItemContext = context;
	}

	public void initView() {
		inflate(listViewItemContext, R.layout.place_result_item, this);

		txtViewName = (TextView) findViewById(R.id.txtPlaceResultName);
		txtViewDescription = (TextView) findViewById(R.id.txtPlaceResultDescription);
		txtViewDistance = (TextView) findViewById(R.id.txtPlaceResultDistance);
		imgView = (ImageView) findViewById(R.id.imgViewPlaceResult);
		imgIconName = (ImageView) findViewById(R.id.imgViewIconResultName);
		imgIconDescription = (ImageView) findViewById(R.id.imgViewIconResultDescription);
		progressBar = (ProgressBar) findViewById(R.id.progressBarPlaceResult);
	}
	
	public void updateThumbImage(Place place, Bitmap bmp) {
		place.updateImage(this, bmp);
	}

	public void bindData(Place place) {
		// TODO Auto-generated method stub
		
		if(place != null) {
			place.bindDataToListViewItem(this);
		}
	}
}
